home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / wind5x.arc / GOOF.PAS next >
Pascal/Delphi Source File  |  1991-01-09  |  2KB  |  72 lines

  1. { =========================================================================== }
  2. { Goof.pas - Displays fatal programming errors              ver 5.X, 12-20-88 }
  3. {                                                                             }
  4. { This file contains a convenient way to alert you of programming errors      }
  5. { since it is possible to create unseen errors with virtual and hidden        }
  6. { windows.  You can edit and recompile this unit at any time since it is      }
  7. { indirectly called.  But you MUST use it, else when CallGoof is              }
  8. { called or your machine will lock up.  So be sure to place this Unit as      }
  9. { the last unit in the MAIN program (see demos).                              }
  10. {   Copyright (C) 1987,1988 by James H. LeMay,  All rights reserved.          }
  11. { =========================================================================== }
  12.  
  13. { R-,S-,I-,D-,T-,F-,V-,B-,N-,L+ }       { TP4 directives }
  14. {$A-,B-,D-,E-,F-,I-,L-,N-,O-,R-,S-,V-}  { TP5 directives }
  15.  
  16. UNIT Goof;
  17.  
  18. INTERFACE
  19.  
  20. uses
  21.   Qwik, Wndw;
  22.  
  23. procedure ShowGoof (ErrorNum: byte);
  24.  
  25.  
  26. IMPLEMENTATION
  27.  
  28. procedure ShowGoof; { (ErrorNum: byte); }
  29. type  Str40 = string[40];
  30. var
  31.   Row,Rows,Col,Cols:   byte;
  32.   Msg1,Msg2,MemS,MaxS: Str40;
  33. begin
  34.   Msg2 := '';
  35.   case ErrorNum of
  36.     1: begin
  37.          Msg1 := 'Not enough Heap space!';
  38.          Str (memavail,MemS);
  39.          Str (maxavail,MaxS);
  40.          Msg2 := 'Mem='+MemS+'/'+'Max='+MaxS;
  41.        end;
  42.     2: Msg1 := 'Too many Windows!';
  43.     3: Msg1 := 'Too many Virtual Windows!';
  44.     4: Msg1 := 'Perm window out of order!';
  45.     5: Msg1 := 'No window to remove!';
  46.     6: Msg1 := 'Hidden window not found!';
  47.     7: Msg1 := 'Virtual screen not found!';
  48.     8: Msg1 := 'Video page not available!';
  49.   end;
  50.   LI := 0;                      { Set top window level }
  51.   TopWndwStat := WndwStat[0];   { Get original CRT stat }
  52.   QScrRec := TWS.VScrRec;       { Set Qwik stats }
  53.   QwritePage (0);               { Ensure we are writing to page 0 }
  54.   QviewPage (0);                { Ensure we are viewing page 0 }
  55.   Rows := 5;
  56.   Cols := 42;
  57.   Row := succ((CRTrows-Rows) shr 1);
  58.   Col := succ((CRTcols-Cols) shr 1);
  59.   WindowModes := RelMode;
  60.   MakeWindow (Row,Col,Rows,Cols,LightGrayBG,LightGrayBG+Blink,
  61.               DoubleBrdr,aWindow);
  62.   WWriteC (1,Msg1);
  63.   WWriteC (2,Msg2);
  64.   WWriteC (3,'Program halted.');
  65.   SetCursor (CursorInitial);
  66.   Halt;
  67. end;
  68.  
  69. BEGIN
  70.   AddrGoof := @ShowGoof;
  71. END.
  72.